/*!
 * \file jbossejb_core.c
 *
 * \brief jboss ejb数据包解析
 *
 * All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.\n
 *
 * \version 2.0
 * \author wuwk
 * \date 2016/02/25
 *
 */
#include <stdlib.h>
#include <stdio.h>

#include "frservice_comm.h"
#include "frmem.h"
#include "frcomm.h"
#include "frhash2.h"
#include "frct_comm.h"

#include "jbossejb_core.h"
//#include "jbossejb_analysis.h"
#include "config.h"

#define JBOSS_LOCAL_USER           "JBOSS-LOCAL-USER"
#define JBOSS_DIGEST_MD5           "DIGEST-MD5"

extern void *g_p_apm_context;

/*!
 * jboss ejb长连接判断
 *
 */
FR_STATIC int __is_longconn(Conntrack *p_st_conn, char *p_data, unsigned int ui_len)
{
    if (p_data == NULL || ui_len < 5)
        return 0;

    p_data += 4; // 4位长度
    ui_len -= 4;

    // message data
    if (*p_data != '\x30')
        return 0;

    p_data++;
    ui_len--;

    // 判断是否请求
    if ((*p_data & 0x80) == 0)
        return 0;

    p_data += 6;
    ui_len -= 6;

    if (*p_data != '\x03' || *(p_data+1) != '\x03')
        return 0;

    return 1;
}

/*!
 * jbossejb 请求解析
 *
 * \param *p_st_private        (L7session_jbossejb_private  jbossejb私有数据)
 * \param *p_st_conn           (Conntrack          连接信息)
 * \param *p_st_hash_report    (Frhash_header      上报链表)
  * \param *p_st_packet        (Apm_packet    数据包信息)
 *
 * \return APM_L7_ANALYZE_SUCC:成功\n
 *         APM_L7_ANALYZE_FAIL:失败\n
 *         APM_L7_ANALYZE_TODO:数据包不完整
 *
 */
FR_STATIC int __jbossejb_analysis_req(L7session_jbossejb_private *p_st_private
                              , Conntrack *p_st_conn
                              , Frhash_header *p_st_hash_report
                              , Apm_packet *p_st_packet)
{
    L4_transaction *p_st_l4_trans = NULL;
    L7_fragment_jbossejb *p_st_fragment = NULL;
    unsigned long ul_time_diff = 0;
    int i_need_report = 0;
    int i_ret = 0;

    if (p_st_private == NULL || p_st_conn == NULL || p_st_hash_report == NULL
        || p_st_private->p_st_fragment == NULL || p_st_packet == NULL)
        return APM_L7_ANALYZE_FAIL;

    p_st_fragment = p_st_private->p_st_fragment;
    p_st_l4_trans = &(p_st_private->st_l4_trans);

    if (frlist_empty(p_st_private->p_lst_req) == FR_NO)
    {
        frreport_body_l7list_free(&p_st_private->p_lst_req);
        frreport_body_l7list_free(&p_st_private->p_lst_mq);
        if (p_st_private->p_st_body_data_req)
            frreport_body_free(&p_st_private->p_st_body_data_req);
        memset(p_st_l4_trans, 0x00, sizeof(L4_transaction));
    }

    if (p_st_private->p_st_body_data_req == NULL)
    {
        p_st_private->p_st_body_data_req = frreport_body_new_l7(p_st_conn);
        if (p_st_private->p_st_body_data_req == NULL)
            return APM_L7_ANALYZE_FAIL;
    }

    if (p_st_l4_trans->st_request_time_first_byte.tv_sec == 0
        && p_st_l4_trans->st_request_time_first_byte.tv_usec == 0)
    {
        /* 请求发起的第一个数据包时间 */
        p_st_l4_trans->st_request_time_first_byte.tv_sec = p_st_packet->st_timestamp.tv_sec;
        p_st_l4_trans->st_request_time_first_byte.tv_usec = p_st_packet->st_timestamp.tv_usec;

        p_st_private->ul_seq = frct_seq_increase(p_st_conn);
    }

    if (frreport_body_l7_add_connInfo(p_st_private->p_st_body_data_req, p_st_conn) == FR_FAIL)
        goto err;

    if (frreport_body_l7_add_ulong(p_st_private->p_st_body_data_req, APM_REPORT_KEY_REQ_ID, p_st_private->ul_seq) == FR_FAIL)
        goto err;

    if (frreport_body_l7_add_timeval(p_st_private->p_st_body_data_req, APM_REPORT_KEY_REQ_START_TIMESTAMP, &p_st_packet->st_timestamp) == FR_FAIL)
        goto err;

    /* 请求结束时间 */
    p_st_l4_trans->st_request_time.tv_sec = p_st_packet->st_timestamp.tv_sec;
    p_st_l4_trans->st_request_time.tv_usec = p_st_packet->st_timestamp.tv_usec;

    if (frreport_body_l7_add_timeval(p_st_private->p_st_body_data_req, APM_REPORT_KEY_REQ_END_TIMESTAMP, &p_st_packet->st_timestamp) == FR_FAIL)
        goto err;

    /* 请求发送时间 */
    ul_time_diff = frtime_diff(&(p_st_l4_trans->st_request_time_first_byte), &(p_st_l4_trans->st_request_time));
    if (frreport_body_l7_add_ulong(p_st_private->p_st_body_data_req, APM_REPORT_KEY_REQ_SEND_TIME_US, ul_time_diff) == FR_FAIL)
        goto err;

    /* 请求的字节数 */
    p_st_l4_trans->l_request_bytes = p_st_fragment->u32_total_len;
    if (frreport_body_l7_add_long(p_st_private->p_st_body_data_req, APM_REPORT_KEY_REQ_DATA_BYTES, p_st_fragment->u32_total_len) == FR_FAIL)
        goto err;

    /* jbossejb数据解析 */
    i_ret = jbossejb_analysis_req(p_st_private, p_st_fragment->p_st_data, p_st_private->p_st_body_data_req, &i_need_report);
    if (i_ret == FR_SUCC)
    {
        if (i_need_report == JBOSSEJB_YES)
        {
            /* 数据上报 */
            i_ret = __jbossejb_data_report(p_st_private, p_st_conn, p_st_hash_report, jbossejb_REQUEST);
            if (i_ret == FR_FAIL)
                goto err;
        }

        return APM_L7_ANALYZE_SET_REQ(APM_L7_ANALYZE_SUCC);
    }
    else if (i_ret == APM_L7_ANALYZE_TODO)
    {
        if (p_st_private->p_st_body_data_req)
            frreport_body_free(&p_st_private->p_st_body_data_req);

        return i_ret;
    }

err:
    if (p_st_private->p_st_body_data_req)
        frreport_body_free(&p_st_private->p_st_body_data_req);

    return APM_L7_ANALYZE_FAIL;

}

/*!
 * jbossejb 响应解析
 *
 * \param *p_st_private        (L7session_jbossejb_private  jbossejb私有数据)
 * \param *p_st_conn           (Conntrack          连接信息)
 * \param *p_st_hash_report    (Frhash_header      上报链表)
  * \param *p_st_packet        (Apm_packet    数据包信息)
 *
 * \return APM_L7_ANALYZE_SUCC:成功\n
 *         APM_L7_ANALYZE_FAIL:失败\n
 *         APM_L7_ANALYZE_TODO:数据包不完整
 *
 */
FR_STATIC int __jbossejb_analysis_resp(L7session_jbossejb_private *p_st_private
                               , Conntrack *p_st_conn
                               , Frhash_header *p_st_hash_report
                               , Apm_packet *p_st_packet)
{
    L4_transaction *p_st_l4_trans = NULL;
    L7_fragment_jbossejb *p_st_fragment = NULL;
    unsigned long ul_time_diff = 0;
    int i_need_report = 0;
    int i_ret = 0;

    if (p_st_private == NULL || p_st_conn == NULL || p_st_hash_report == NULL
        || p_st_private->p_st_fragment == NULL || p_st_packet == NULL)
        return APM_L7_ANALYZE_FAIL;

    p_st_fragment = p_st_private->p_st_fragment;
    p_st_l4_trans = &(p_st_private->st_l4_trans);

    if (p_st_private->p_st_body_data_resp == NULL)
    {
        p_st_private->p_st_body_data_resp = frreport_body_new_l7(p_st_conn);
        if (p_st_private->p_st_body_data_resp == NULL)
            return APM_L7_ANALYZE_FAIL;
    }

    if (p_st_l4_trans->st_response_time_first_byte.tv_sec == 0
        && p_st_l4_trans->st_response_time_first_byte.tv_usec == 0)
    {
        /* 响应发起的第一个数据包时间 */
        p_st_l4_trans->st_response_time_first_byte.tv_sec = p_st_packet->st_timestamp.tv_sec;
        p_st_l4_trans->st_response_time_first_byte.tv_usec = p_st_packet->st_timestamp.tv_usec;
    }

    i_ret = frreport_body_l7_add_connInfo(p_st_private->p_st_body_data_resp, p_st_conn);
    if (i_ret == FR_FAIL)
        goto err;

    /* 有request */
    if (p_st_l4_trans->st_request_time.tv_sec != 0 && p_st_private->p_lst_req != NULL)
    {
        if (FRREPORT_BODY_L7LIST_SET_REQ(p_st_private->p_st_body_data_resp, &p_st_private->p_lst_req) == FR_FAIL)
            goto err;

        if (p_st_private->p_lst_mq != NULL)
        {
            if (FRREPORT_BODY_L7LIST_SET_MQ(p_st_private->p_st_body_data_resp, &p_st_private->p_lst_mq) == FR_FAIL)
                goto err;
        }

        ul_time_diff = frtime_diff(&(p_st_l4_trans->st_request_time), &p_st_packet->st_timestamp);
        if (frreport_body_l7_add_ulong(p_st_private->p_st_body_data_resp, APM_REPORT_KEY_RESP_SERVER_TIME_US, ul_time_diff) == FR_FAIL)
            goto err;
    }
    else
    {
        if (frreport_body_l7_add_ulong(p_st_private->p_st_body_data_resp, APM_REPORT_KEY_RESP_SERVER_TIME_US, 0) == FR_FAIL)
            goto err;
    }

    if (frreport_body_l7_add_timeval(p_st_private->p_st_body_data_resp, APM_REPORT_KEY_RESP_START_TIMESTAMP, &p_st_packet->st_timestamp) == FR_FAIL)
        goto err;

    /* 结束时间 */
    p_st_l4_trans->st_response_time.tv_sec = p_st_packet->st_timestamp.tv_sec;
    p_st_l4_trans->st_response_time.tv_usec = p_st_packet->st_timestamp.tv_usec;
    if (frreport_body_l7_add_timeval(p_st_private->p_st_body_data_resp, APM_REPORT_KEY_RESP_END_TIMESTAMP, &p_st_packet->st_timestamp) == FR_FAIL)
        goto err;

    /* 下载时间 */
    ul_time_diff = frtime_diff(&(p_st_l4_trans->st_response_time_first_byte), &p_st_packet->st_timestamp);
    if (frreport_body_l7_add_ulong(p_st_private->p_st_body_data_resp, APM_REPORT_KEY_RESP_DOWNLOAD_TIME_US, ul_time_diff) == FR_FAIL)
        goto err;

    /* 响应的字节数 */
    p_st_l4_trans->l_response_bytes = p_st_fragment->u32_total_len;
    if (frreport_body_l7_add_long(p_st_private->p_st_body_data_resp, APM_REPORT_KEY_RESP_DATA_BYTES, p_st_fragment->u32_total_len) == FR_FAIL)
        goto err;

    /* jbossejb数据解析 */
    i_ret = jbossejb_analysis_resp(p_st_private, p_st_fragment->p_st_data, p_st_private->p_st_body_data_resp, &i_need_report);
    if (i_ret == FR_SUCC)
    {
        if (i_need_report == JBOSSEJB_YES)
        {
            /* 数据上报 */
            i_ret = __jbossejb_data_report(p_st_private, p_st_conn, p_st_hash_report, jbossejb_RESPONSE);
            if (i_ret == FR_FAIL)
                return APM_L7_ANALYZE_FAIL;
        }

        __jbossejb_reset_private(p_st_private);

        return APM_L7_ANALYZE_SET_RESP(APM_L7_ANALYZE_SUCC);
    }
    else if (i_ret == APM_L7_ANALYZE_TODO)
    {
        if (p_st_private->p_st_body_data_resp)
        {
            /* 保存request数据 */
            p_st_private->p_lst_req = FRREPORT_BODY_L7LIST_CLONE_REQ(p_st_private->p_st_body_data_resp);
            if (p_st_private->p_lst_req == NULL)
                goto err;

            frreport_body_free(&p_st_private->p_st_body_data_resp);
        }

        return i_ret;
    }

err:
    if (p_st_private->p_st_body_data_resp)
        frreport_body_free(&p_st_private->p_st_body_data_resp);

    return APM_L7_ANALYZE_FAIL;
}

/*!
 * jbossejb packet解析
 *
 * \param *p_st_private        (L7session_jbossejb_private  jboss ejb私有数据)
 * \param *p_st_conn           (Conntrack          连接信息)
 * \param *p_st_packet         (Apm_packet    数据包信息)
 * \param *p_st_hash_report    (Frhash_header      上报链表)
 * \param *p_data              (char                  数据包数据)
 * \param ui_data_len          (unsigned int      数据包数据长度)
 *
 * \return APM_L7_ANALYZE_SUCC:成功\n
 *         APM_L7_ANALYZE_FAIL:失败\n
 *         APM_L7_ANALYZE_TODO:数据包不完整
 *
 */
FR_STATIC int __jbossejb_getdata_analysis(L7session_jbossejb_private *p_st_private
                                  , Conntrack *p_st_conn
                                  , Frhash_header *p_st_hash_report
                                  , Apm_packet *p_st_packet
                                  , char *p_data
                                  , unsigned int ui_data_len)
{
    L7_fragment_jbossejb *p_st_fragment = NULL;
    char arr_len[5];
    uint32_t *p_u32_len = 0;
    unsigned int ui_left_len = 0;
    int i_ret = 0;

    if (p_st_private == NULL || p_st_conn == NULL || p_st_hash_report == NULL
        || p_st_private->p_st_fragment == NULL || p_st_packet == NULL || p_data == NULL)
        return APM_L7_ANALYZE_FAIL;

    p_st_fragment = p_st_private->p_st_fragment;
    if (ui_data_len == 0)
        return APM_L7_ANALYZE_TODO;

    // 创建bytebuffer
    if (p_st_fragment->p_st_data == NULL)
    {
        // 做成bytebuffer
        p_st_fragment->p_st_data = bytebuff_creat();
        if (p_st_fragment->p_st_data == NULL)
            goto err;
    }

    //上次packet还遗留的数据长度
    ui_left_len = p_st_fragment->u32_left_len;

    // 上次的数据包不完整
    if (ui_left_len)
    {
        // 本次数据还不够
        if (ui_left_len > ui_data_len)
        {
            if (ui_data_len != 0)
            {
                // 将本次数据存入buffer
                i_ret = bytebuff_add(p_st_fragment->p_st_data, p_data, ui_data_len);
                if (i_ret != FR_SUCC)
                    goto err;
                p_st_fragment->u32_left_len -= ui_data_len;
            }
        }
        else
        {
            // 将剩余需要的数据存入buffer
            i_ret = bytebuff_add(p_st_fragment->p_st_data, p_data, ui_left_len);
            if (i_ret != FR_SUCC)
                goto err;
            p_st_fragment->u32_left_len = 0;
        }

        if (p_st_fragment->p_st_data->ui_skip_len != 0)
            return APM_L7_ANALYZE_TODO;

        // 解析当前体数据
        if (p_st_packet->i_direction == FR_DIRECT_CLIENT2SRV)
            i_ret = __jbossejb_analysis_req(p_st_private, p_st_conn, p_st_hash_report, p_st_packet);
        else
            i_ret = __jbossejb_analysis_resp(p_st_private, p_st_conn, p_st_hash_report, p_st_packet);
        if (i_ret == APM_L7_ANALYZE_FAIL)
            goto err;
        else if (i_ret == APM_L7_ANALYZE_TODO)
            return APM_L7_ANALYZE_TODO;
        else
        {
            if (p_st_fragment->p_st_data)
                bytebuff_free(&p_st_fragment->p_st_data);
            p_st_fragment->u32_total_len = 0;

            return i_ret;
        }
    }

    // 上次的数据包完整，开始新的数据包解析
    // 数据长度小于4
    if (ui_data_len < 4)
        return APM_L7_ANALYZE_FAIL;

    /* 数据长度解析, 4字节 */
    memcpy(arr_len, p_data, 4);
    p_u32_len = (uint32_t *)arr_len;
    p_st_fragment->u32_total_len = ntohl(*p_u32_len);

    // 数据长度不够
    if (p_st_fragment->u32_total_len > ui_data_len)
    {
        if (ui_data_len != 0)
        {
            i_ret = bytebuff_add(p_st_fragment->p_st_data, p_data, ui_data_len);
            if (i_ret != FR_SUCC)
                goto err;
        }
        p_st_fragment->u32_left_len = p_st_fragment->u32_total_len - ui_data_len;
    }
    else
    {
        i_ret = bytebuff_add(p_st_fragment->p_st_data, p_data, p_st_fragment->u32_total_len);
        if (i_ret != FR_SUCC)
            goto err;
        p_st_fragment->u32_left_len = 0;
    }

    // 解析体数据
    if (p_st_packet->i_direction == FR_DIRECT_CLIENT2SRV)
        i_ret = __jbossejb_analysis_req(p_st_private, p_st_conn, p_st_hash_report, p_st_packet);
    else
        i_ret = __jbossejb_analysis_resp(p_st_private, p_st_conn, p_st_hash_report, p_st_packet);
    if (i_ret == APM_L7_ANALYZE_FAIL)
        goto err;
    else if (i_ret == APM_L7_ANALYZE_TODO)
        return APM_L7_ANALYZE_TODO;
    else
    {
        if (p_st_fragment->p_st_data)
            bytebuff_free(&p_st_fragment->p_st_data);
        p_st_fragment->u32_total_len = 0;

        return i_ret;
    }

err:
    __jbossejb_reset_private(p_st_private);
    return APM_L7_ANALYZE_FAIL;
}

/*!
 * 判断是否为jbossejb数据包
 *
 * \param *p_st_conn       (Conntrack      连接信息)
 * \param *p_st_packet     (Apm_packet    数据包信息)
 *
 * \return APM_L7_IS_NO:不属于TCP协议\n
 *         APM_L7_IS_YES:属于TCP协议
 *
 */
int jbossejb_detect(Conntrack *p_st_conn, Apm_packet *p_st_packet)
{
    char *p_data = NULL;
    unsigned int ui_data_len = 0;
    int i_ret = 0;

    if (p_st_conn == NULL || p_st_packet == NULL || p_st_packet->p_payload == NULL || p_st_packet->ui_payload_len == 0)
        return APM_L7_IS_NO;

    p_data = p_st_packet->p_payload;
    ui_data_len = p_st_packet->ui_payload_len;

    if (frmemstr(p_data, ui_data_len, JBOSS_LOCAL_USER, strlen(JBOSS_LOCAL_USER)) != NULL
        && frmemstr(p_data, ui_data_len, JBOSS_DIGEST_MD5, strlen(JBOSS_DIGEST_MD5)) != NULL)
    {
        // 响应
        if (frct_get_direct_known(p_st_conn) != FR_DIRECT_KNOWN)
        {
            i_ret = frcap_set_cs_srv(p_st_conn, p_st_packet->src_ip, p_st_packet->src_port);
            if (i_ret != FR_SUCC)
            {
                frdbg("frcap_set_cs_srv failed\n");
                return APM_L7_IS_NO;
            }
        }
        frservice_add(g_p_apm_context, MODULE_L7PROTO, p_st_packet->src_ip, p_st_packet->src_port, NULL, 0);
        return APM_L7_IS_YES;
    }
    else
    {
        // 长连接
        if (__is_longconn(p_st_conn, p_data, ui_data_len))
        {
            if (frct_get_direct_known(p_st_conn) != FR_DIRECT_KNOWN)
            {
                i_ret = frcap_set_cs_srv(p_st_conn, p_st_packet->dst_ip, p_st_packet->dst_port);
                if (i_ret != FR_SUCC)
                {
                    frdbg("frcap_set_cs_srv failed\n");
                    return APM_L7_IS_NO;
                }
            }
            frservice_add(g_p_apm_context, MODULE_L7PROTO, p_st_packet->dst_ip, p_st_packet->dst_port, NULL, 0);
            return APM_L7_IS_YES;
        }
    }

    // 识别协议查询
    if (frct_get_direct_known(p_st_conn) == FR_DIRECT_UNKNOWN)
    {
        i_ret = frservice_get(g_p_apm_context, MODULE_L7PROTO, p_st_packet->dst_ip, p_st_packet->dst_port, NULL, 0, NULL);
        if (i_ret == FR_SUCC)
        {
            frcap_set_cs_srv(p_st_conn, p_st_packet->dst_ip, p_st_packet->dst_port);
            return APM_L7_IS_YES;
        }
        i_ret = frservice_get(g_p_apm_context, MODULE_L7PROTO, p_st_packet->src_ip, p_st_packet->src_port, NULL, 0, NULL);
        if (i_ret == FR_SUCC)
        {
            frcap_set_cs_srv(p_st_conn, p_st_packet->src_ip, p_st_packet->src_port);
            return APM_L7_IS_YES;
        }
    }
    else
    {
        i_ret = frservice_get(g_p_apm_context, MODULE_L7PROTO, p_st_packet->dst_ip, p_st_packet->dst_port, NULL, 0, NULL);
        if (i_ret == FR_SUCC)
            return APM_L7_IS_YES;
    }
    return APM_L7_IS_NO;
}

/*!
 * 私有数据创建
 *
 */
L7session_jbossejb_private *__jbossejb_private_create(void)
{
    L7session_jbossejb_private *p_st_private = NULL;
    L7_fragment_jbossejb *p_st_fragment = NULL;
    L7Session_jbossejb *p_st_session = NULL;

    p_st_private = (L7session_jbossejb_private *)frmalloc(sizeof(L7session_jbossejb_private));
    if (p_st_private == NULL)
        return NULL;
    memset(p_st_private, 0x00, sizeof(L7session_jbossejb_private));

    p_st_fragment = (L7_fragment_jbossejb *)frmalloc(sizeof(L7_fragment_jbossejb));
    if (p_st_fragment == NULL)
    {
        frfree(p_st_private);
        return NULL;
    }
    memset(p_st_fragment, 0x00, sizeof(L7_fragment_jbossejb));

    p_st_session = (L7Session_jbossejb *)frmalloc(sizeof(L7Session_jbossejb));
    if (p_st_session == NULL)
    {
        frfree(p_st_private);
        frfree(p_st_fragment);
        return NULL;
    }
    memset(p_st_session, 0x00, sizeof(L7Session_jbossejb));

    p_st_private->p_st_fragment = p_st_fragment;
    p_st_private->p_st_session = p_st_session;

    return p_st_private;
}

/*!
 * jbossejb 解析
 *
 * \param *p_st_conn           (Conntrack          连接信息)
 * \param *p_st_packet         (Apm_packet    数据包信息)
 * \param *p_st_hash_report    (Frhash_header      上报链表)
 *
 * \return APM_L7_ANALYZE_SUCC:成功\n
 *         APM_L7_ANALYZE_FAIL:失败\n
 *         APM_L7_ANALYZE_TODO:数据包不完整
 *
 */
int jbossejb_analysis(Conntrack *p_st_conn
              , Apm_packet *p_st_packet
              , Frhash_header *p_st_hash_report)
{
    int i_ret = APM_L7_ANALYZE_SUCC;
    L7_session *p_st_session = NULL;

    if (p_st_conn == NULL || p_st_packet == NULL || p_st_hash_report == NULL)
        return APM_L7_ANALYZE_FAIL;

    /* 到Conntrack中取得session信息 */
    p_st_session = frct_get_session(p_st_conn);
    if (p_st_session == NULL)
        return APM_L7_ANALYZE_FAIL;

    //fin syn 包  销毁私有数据
    if (p_st_packet->em_analyz_cmd == FRANALYZ_CMD_FIN || p_st_packet->em_analyz_cmd == FRANALYZ_CMD_SYN)
    {
        jbossejb_session_destroy((void *)(p_st_session->p_session_private));
        p_st_session->p_session_private = NULL;
        return APM_L7_ANALYZE_SUCC;
    }

    //p_session_private   分配内存
    if (p_st_session->p_session_private == NULL)
    {
        p_st_session->p_session_private = __jbossejb_private_create();
        //内存分配失败
        if (p_st_session->p_session_private == NULL)
            return APM_L7_ANALYZE_FAIL;
    }

    i_ret = __jbossejb_getdata_analysis((L7session_jbossejb_private *)p_st_session->p_session_private
                                , p_st_conn
                                , p_st_hash_report
                                , p_st_packet
                                , p_st_packet->p_payload
                                , p_st_packet->ui_payload_len);
    if (i_ret == APM_L7_ANALYZE_FAIL)
        return APM_L7_ANALYZE_FAIL;

    return APM_L7_ANALYZE_SUCC;
}


/*!
 * jbossejb 私有信息销毁
 *
 * \param *p_private_session    (jbossejb的私有session数据)
 *
 * \return FR_SUCC:成功\n
 *         FR_FAIL:失败
 *
 */
int jbossejb_session_destroy(void *p_private_session)
{

    return FR_SUCC;
}
